from typing import Optional
from pydantic import BaseModel


class Token(BaseModel):
    access_token: str
    refresh_token: str
    token_type: str = "bearer"


class TokenPayload(BaseModel):
    sub: Optional[str] = None
    exp: Optional[int] = None
    type: Optional[str] = None
    jti: Optional[str] = None


class TokenRefresh(BaseModel):
    refresh_token: str


class LoginResponse(BaseModel):
    token: Token
    user: "User"


# Lazy import to avoid circular dependency
from app.schemas.user import User  # noqa: E402  # isort:skip
LoginResponse.model_rebuild()
